import { createRequestTypes } from '@UTILS/reduxHelper'
export const GLOBAL_SEARCH = createRequestTypes('GLOBAL_SEARCH')
export const SET_SEARCH_HISTORY = createRequestTypes('SET_SEARCH_HISTORY')
export const INITIAL_SEARCH_HISTORY = createRequestTypes('INITIAL_SEARCH_HISTORY')
export const CLEAR_SEARCH_HISTORY = createRequestTypes('CLEAR_SEARCH_HISTORY')

export default {
  dispatchGlobalSearch(params) {
    return {
      type: GLOBAL_SEARCH.REQUEST,
      params
    }
  },
  dispatchSetSearchHistory(st) {
    return {
      type: SET_SEARCH_HISTORY.REQUEST,
      st,
    }
  },
  dispatchClearSearchHistory(index) {
    return {
      type: CLEAR_SEARCH_HISTORY.REQUEST,
      index,
    }
  },
  dispatchInitSearchHistory() {
    return {
      type: INITIAL_SEARCH_HISTORY.REQUEST,
    }
  }
}
